#pragma once

#include <d3d11.h>
#include <d3dx10math.h>
#include <vector>

#include "Color.h"

namespace Graphics
{
	class Font;
	class FontShader;
	class D3DDevice;
	class Buffer;
}

namespace Graphics
{
class Text
{
struct SentenceType
{
	SentenceType()
	{
		vertexBuffer = NULL;
		indexBuffer = NULL;
	}

	ID3D11Buffer *vertexBuffer, *indexBuffer;
	int vertexCount, indexCount, maxLength;
};

struct TextObject
{
	std::string Text;
	int XPosition, YPosition;
	Color TextColor;
	SentenceType* Sentence;
};

public:
	Text(void);
	virtual ~Text(void);
	bool Initialize(HWND hwnd, int screenWidth, int screenHeight, D3DXMATRIX baseViewMatrix);
	void Deinitialize();
	void Update(float gameTime);
	bool Render();
	void SetText(int x_pos, int y_pos, const char* format, ... );

private:
	bool InitializeSentenceType(int maxLength);
	bool UpdateSentenceType(const char* text, int positionX, int positionY, Color color);

private:
	static Font* mFont;
	static FontShader* mFontShader;
	int mScreenWidth, mScreenHeight;
	D3DXMATRIX mBaseViewMatrix;
	int mMaxLength;
	TextObject mTextObj;
};
}